const baseUrl="https://gzdtapi.xuhuihealth.cn/bluetooth/api/"

export const request = (options) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: baseUrl + options.url,
			method: options.method || 'GET',
			data: options.data || {},
			success: res => {
				if (res.data.code != 200) {
					// return uni.showToast({
					// 	title: res.msg||'获取失败'
					// })
				}
				resolve(res)
			},
			fail: (err) => {
				uni.showToast({
					title: '请求接口失败'
				})
				reject(err)
			}
		})
	})
}

/* function request(url, data, method) {
    return new Promise((resolve, reject) => {
        uni.request({
            url: baseUrl + url,
            method: method,
            data,
            success: (res) => {
                if (res.data.code == 200) {
                    resolve(res.data.data, res.data);
                } else {
                    reject(res.data.msg, res.data);
                }
            },
            fail: (error) => {
                reject(error)
            },
            complete: () => {
                // uni.hideLoading()
            }
        });
    })
}

export default request */
